import java.awt.event.KeyEvent;

import org.powerbot.core.script.job.Task;
import org.powerbot.core.script.job.state.Node;
import org.powerbot.game.api.methods.Game;
import org.powerbot.game.api.methods.Widgets;
import org.powerbot.game.api.methods.input.Keyboard;
import org.powerbot.game.api.methods.interactive.Players;
import org.powerbot.game.api.methods.tab.Inventory;


public class Drop extends Node{


	public static zKey key1 = new zKey((char)KeyEvent.VK_1), 
			key2 = new zKey((char)KeyEvent.VK_2);
	@Override
	public boolean activate() {
		// TODO Auto-generated method stub
		return Fisher.dropping && Game.isLoggedIn();
	}

	@Override
	public void execute() {
		// TODO Auto-generated method stub
		//EOC number 1 && 2 drop
		//335 331
		//DROP TROUT then drop salmon,
		int trout =Inventory.getCount(335) ,
				salmon = Inventory.getCount(331),
				inv = Inventory.getCount(),
				shrimp = Inventory.getCount(317);
		if(inv <= 1)
		{
			Fisher.dropping= false;
		}
		//System.out.println(!(Widgets.get(1186).getChildrenCount()>0));
		if(Widgets.get(1186).getChildrenCount()>0)
		{
			Widgets.get(1186).getChild(8).click(true);
			Task.sleep(500);
		}
		else
		{
			if(trout != 0 || shrimp!=0)
				key1.down();
			else
				key1.up();
		
			if(salmon != 0 && trout == 0 && !key1.isDown)
				key2.down();
			else 
				key2.up();
		
		}	
	}
}
